/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.lostreseditores.modelo;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author DILOVE
 */
@Entity
@Table(name = "examen")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Examen.findAll", query = "SELECT e FROM Examen e"),
    @NamedQuery(name = "Examen.findByIdExamen", query = "SELECT e FROM Examen e WHERE e.idExamen = :idExamen"),
    @NamedQuery(name = "Examen.findByNombreexamen", query = "SELECT e FROM Examen e WHERE e.nombreexamen = :nombreexamen")})
public class Examen implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "id_examen")
    private Integer idExamen;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 255)
    @Column(name = "nombreexamen")
    private String nombreexamen;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "examen")
    private List<Premarcado> premarcadoList;
    @JoinColumn(name = "id_tipo", referencedColumnName = "id_tipo")
    @ManyToOne(optional = false)
    private Tipoexamen idTipo;
    @JoinColumn(name = "id_esquema", referencedColumnName = "id_esquema")
    @ManyToOne(optional = false)
    private Esquemacalificacion idEsquema;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "examen")
    private List<Presentaexamen> presentaexamenList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "examen")
    private List<Examenpreguntas> examenpreguntasList;

    public Examen() {
    }

    public Examen(Integer idExamen) {
        this.idExamen = idExamen;
    }

    public Examen(Integer idExamen, String nombreexamen) {
        this.idExamen = idExamen;
        this.nombreexamen = nombreexamen;
    }

    public Integer getIdExamen() {
        return idExamen;
    }

    public void setIdExamen(Integer idExamen) {
        this.idExamen = idExamen;
    }

    public String getNombreexamen() {
        return nombreexamen;
    }

    public void setNombreexamen(String nombreexamen) {
        this.nombreexamen = nombreexamen;
    }

    @XmlTransient
    public List<Premarcado> getPremarcadoList() {
        return premarcadoList;
    }

    public void setPremarcadoList(List<Premarcado> premarcadoList) {
        this.premarcadoList = premarcadoList;
    }

    public Tipoexamen getIdTipo() {
        return idTipo;
    }

    public void setIdTipo(Tipoexamen idTipo) {
        this.idTipo = idTipo;
    }

    public Esquemacalificacion getIdEsquema() {
        return idEsquema;
    }

    public void setIdEsquema(Esquemacalificacion idEsquema) {
        this.idEsquema = idEsquema;
    }

    @XmlTransient
    public List<Presentaexamen> getPresentaexamenList() {
        return presentaexamenList;
    }

    public void setPresentaexamenList(List<Presentaexamen> presentaexamenList) {
        this.presentaexamenList = presentaexamenList;
    }

    @XmlTransient
    public List<Examenpreguntas> getExamenpreguntasList() {
        return examenpreguntasList;
    }

    public void setExamenpreguntasList(List<Examenpreguntas> examenpreguntasList) {
        this.examenpreguntasList = examenpreguntasList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idExamen != null ? idExamen.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Examen)) {
            return false;
        }
        Examen other = (Examen) object;
        if ((this.idExamen == null && other.idExamen != null) || (this.idExamen != null && !this.idExamen.equals(other.idExamen))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.lostreseditores.modelo.Examen[ idExamen=" + idExamen + " ]";
    }
    
}
